package edu.sctu.zhoudie.mouth201505.day20150506;

/**
 * Created by user08 on 2015/5/6.
 */

import java.util.*;

public class ListDemo {


    public static void main(String[] args) {

        int numHands = 4;
        int cardsPerHand = 52 / 4;

        String[] suit = new String[]{
                "黑桃", "红心", "方块", "梅花"};


        String[] rank = new String[]{
                "ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "jack", "queen", "king"};


        List list = new ArrayList();

        for (int i = 0; i < suit.length; i++) {

            for (int j = 0; j < rank.length; j++) {
                list.add(rank[j] + suit[i]);

            }
        }

        Collections.shuffle(list);

        for (int i = 0; i < numHands; i++)
            System.out.println(perHand(list, cardsPerHand));

    }

    public static List perHand(List list, int n) {

        int deckSize = list.size();
        List handView = list.subList(deckSize - n, deckSize);
        List hand = new ArrayList(handView);
        handView.clear();

        return hand;


    }

}
